package com.salary.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.salary.entity.dto.BasicSalaryDTO;
import com.staff.entity.Staff;


@Entity
@Table(name="t_basic_salary")
public class BasicSalary {//基本工资实体类，实现关联关系
	private Long id;
	private float amount;
	private Date createTime;
	private Date updateTime;
	private Staff staff = null;
	private Staff operator = null;
	
	
	public BasicSalary(BasicSalaryDTO dto,Staff staff,Staff operator) {
		super();
		this.id = dto.getId();
		this.amount = dto.getAmount();
		this.createTime = dto.getCreateTime();
		this.updateTime = dto.getUpdateTime();
		this.staff = staff;
		this.operator = operator;
	}
	public BasicSalary() {
		super();
	}
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	@OneToOne(cascade=CascadeType.ALL)
	public Staff getStaff() {
		return staff;
	}
	@ManyToOne(cascade=CascadeType.ALL)
	public Staff getOperator() {
		return operator;
	}
	public float getAmount() {
		return amount;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getCreateTime() {
		return createTime;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setAmount(float amount) {
		this.amount = amount;
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public void setOperator(Staff operator) {
		this.operator = operator;
	}
	
}
